<template>
  <div class="k-search">
    <label class="k-search-label" v-if="!hiddenLabel">筛选查询</label>
    <slot name="prefix"></slot>

    <div class="k-search-body">
      <slot></slot>

      <div class="k-search-export" v-if="showExport">
        <a href="javascript:;" @click="onClickExport">
          <i class="icon icon-export"></i>
          导出
        </a>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'KSearch',
  props: {
    showExport: Boolean,
    hiddenLabel: Boolean
  },
  methods: {
    onClickExport () {
      this.$emit('export')
    }
  }
}
</script>

<style scoped lang="scss">
  .k-search {
    margin: 10px 3px 3px;
    padding: 20px;
    box-shadow: 1px 2px 3px #efefef;
    background: #fff;
    border-radius: 5px;
    display: flex;
    align-items: center;
    &-label {
      font-size: 18px;
      color: #3f3f3f;
      padding-right: 20px;
      display: block;
    }
    &-body {
      flex: 1;
      position: relative;
    }
    &-export {
      position: absolute;
      right: 0;
      bottom: 0;
      a {
        color: #666;
        text-decoration: none;
      }
    }
  }
</style>
